#include "ThreadPool.hpp"
#include "Task.hpp"
#include "Thread.hpp"
#include <ctime>
#include <memory>
#include <unistd.h>

int main()
{
    srand(time(nullptr));
    // std::unique_ptr<ThreadPool<Task>> tp(new ThreadPool<Task>());
    ThreadPool<Task>* tp = new ThreadPool<Task>();
    tp->Start();
    while(true)
    {
        int x = rand() % 100;
        usleep(rand() % 100);
        int y = rand() % 100;
        usleep(rand() % 100);
        char oper = Task::opers[rand() % Task::opers.size()];

        Task task(x, y, oper);
        std::cout << task.PrintTask() << std::endl;
        task.PrintTask();
        tp->Push(task);
        sleep(1);
    }
    tp->Join();
}